package com.spring.demo1.processor;
import org.springframework.beans.BeansException;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.util.ClassUtils;

import com.spring.demo1.inter.TestInferface;

/**
 * MyBeanFactoryPostProcessor
 *
 * @author Yuanqing Luo
 * @since 2019/3/20
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
        BeanDefinition beanDefinition = configurableListableBeanFactory.getBeanDefinition(ClassUtils.getShortName(TestInferface.class));
        MutablePropertyValues mpv = beanDefinition.getPropertyValues();
        mpv.add("hello", "hello world");
    }
}